<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE" />
<title>添加用户页面</title>
<link href="<%=basePath%>css/all.css" rel="stylesheet" type="text/css" />
<title>JSP Page</title>
</head>
<body style="background: #e1e9eb;">
	<form action="<%=basePath%>updateOrInsertPhone" id="updateForm" method="post"
		enctype="multipart/form-data">
		<input type="hidden" name="id" value="${phone.id}" />
		<input type="hidden" name="findname" value="${findPhone.name}" /> 
		<input type="hidden" name="currentPage" value="${currentPage}" />
		<div class="right">
			<div class="current">
				当前位置：<a href="<%=basePath%>roomList" style="color: #6E6E6E;">商品管理</a>
				&gt; 信息维护
			</div>
			<div class="rightCont">
				<p class="g_title fix">信息维护</p>
				<table class="tab1">
					<tbody>
						<tr>
							<td width="90" align="right">商品照片：</td>
							<td><c:if test="${!empty phone.pic}">
									<img src="/pic/${phone.pic}" width=100 height=100 />
									<br />
								</c:if> <input type="file" name="photo" /></td>

						</tr>
						<tr>
							<td width="90" align="right">商品名称：</td>
							<td><input type="text" name="name"
								class="allInput" value="${phone.name }" /></td>
						</tr>
						<tr>
							<td width="90" align="right">商品价格：</td>
							<td>
								<input type="text" name="price"
								class="allInput" value="${phone.price }" />
							</td>
						</tr>
						<tr>
							<td width="90" align="right">上架时间：</td>
							<td>
								<input type="date" name="createdate" 
								value="<fmt:formatDate value="${phone.createdate}" pattern="yyyy-MM-dd"/>"/>
							</td>
						</tr>
						<tr>
						
							<td width="90" align="right">品牌名称：</td>
							<td>
								<select name = "brandid">
									<c:choose>
										<c:when test="${!empty phone.brandid }">
										<option value="${phone.brandid }">${phone.brandName }</option>
										<c:forEach items="${brandList }" var="brand">
											<option value="">--请选择--</option>
											<c:if test="${phone.brandid != brand.id }">
												<option value="${brand.id }">${brand.name }</option>
											</c:if>
										</c:forEach>
										</c:when>
										<c:otherwise>
										<option value="">--请选择--</option>
										<c:forEach items="${brandList }" var="brand">
											<option value="${brand.id }">${brand.name }</option>
										</c:forEach>
										</c:otherwise>
									</c:choose>
									
								</select>
							</td>
						</tr>
						
						<tr>
							<td width="85" align="right"><input type="submit"
								class="tabSub" value="保存" /></td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
	</form>
</body>
</html>
